//
//  NSString+extension.m
//  TY_MotorRemoteControl
//
//  Created by 徐伟新 on 2023/11/15.
//  Copyright © 2023 zhongdaodianzi. All rights reserved.
//

#import "NSString+extension.h"

@implementation NSString (extension)
- (NSString *)subStringWithRangeForNil:(NSRange)range {
    
    if (range.location +range.length > self.length) {
        NSMutableString *result = [NSMutableString string];
        for (NSInteger i = 0; i < range.length; i++) {
            [result appendString:@"0"];
        }
        return result;
    }
    return [self substringWithRange:range];
}

@end
